package com.zhongyu.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhongyu.pojo.KucunBiandong;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface KuCunBdMapper  extends BaseMapper<KucunBiandong> {
    @Select("select t1.*,t2.id ,t2.*,t3.id,t3.*,t4.id,t4.* from smbms_kucun_biandong t1\n" +
            "left  join smbms_user t2 on t1.userid=t2.id\n " +
            "left join  smbms_cangku t3 on t1.cangku_id=t3.id\n" +
            "left join smbms_goods t4 on t1.goods_id=t4.id  ${ew.customSqlSegment}")
    @ResultMap("kucunBdRm")
    List<KucunBiandong> findAll(Page page , @Param("ew") Wrapper wrapper);

    @Select("select t1.*,t2.id ,t2.*,t3.id,t3.*,t4.id,t4.* from smbms_kucun_biandong t1\n" +
            "left  join smbms_user t2 on t1.userid=t2.id\n " +
            "left join  smbms_cangku t3 on t1.cangku_id=t3.id\n" +
            "left join smbms_goods t4 on t1.goods_id=t4.id  where t1.cangku_id=#{cangkuId} and t1.goods_id=#{goodsId}")
    @ResultMap("kucunBdRm")
    List<KucunBiandong>findById(Integer cangkuId,Integer goodsId);
}
